package com.ecoolex.hotel.saas.ws;

import java.util.List;

import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import com.ecoolex.framework.common.exception.BizException;
import com.ecoolex.framework.common.pojo.Page;
import com.ecoolex.framework.common.pojo.Pagination;
import com.ecoolex.hotel.saas.core.manager.DistributionManager;
import com.ecoolex.hotel.saas.core.manager.PresaleCouponCategoryJointManager;
import com.ecoolex.hotel.saas.core.manager.PresaleCouponCategoryManager;
import com.ecoolex.hotel.saas.entity.Distribution;
import com.ecoolex.hotel.saas.entity.PresaleCouponCategory;
import com.ecoolex.hotel.saas.entity.PresaleCouponCategoryJoint;
import com.ecoolex.hotel.saas.pojo.AddPresaleCouponCategoryJointDTO;

@Service
public class OperationServiceImpl implements OperationService{
	
	@Autowired
	private DistributionManager distributionManager;
	
	@Override
	public Distribution getDistribution(Integer distributionId) {
		return distributionManager.getDistribution(distributionId);
	}

	@Override
	public Distribution getByDepartmentIdAndType(Integer departmentId, Integer type) {
		return distributionManager.getByDepartmentIdAndType(departmentId, type);
	}

	@Override
	public Distribution addDistribution(Distribution add, String createUser) throws BizException {
		return distributionManager.addDistribution(add, createUser);
	}

	@Override
	public Distribution editDistribution(Distribution edit, String updateUser) throws BizException {
		return distributionManager.editDistribution(edit, updateUser);
	}
	
	@Autowired
	private PresaleCouponCategoryManager presaleCouponCategoryManager;
	
	@Override
	public PresaleCouponCategory getPresaleCouponCategory(Integer categoryId) {
		return presaleCouponCategoryManager.getPresaleCouponCategory(categoryId);
	}

	@Override
	public Pagination<PresaleCouponCategory> queryPresaleCouponCategory(Integer storeId, String name, Page page) {
		return presaleCouponCategoryManager.queryPresaleCouponCategory(storeId, name, page);
	}

	@Override
	public Pagination<PresaleCouponCategory> queryPresaleCouponCategoryForUser(Integer storeId, String name, Page page) {
		return presaleCouponCategoryManager.queryForUser(storeId, name, page);
	}

	@Override
	public PresaleCouponCategory addPresaleCouponCategory(PresaleCouponCategory add, String createUser) throws BizException {
		return presaleCouponCategoryManager.addPresaleCouponCategory(add, createUser);
	}

	@Override
	public PresaleCouponCategory editPresaleCouponCategory(PresaleCouponCategory edit, String updateUser) throws BizException {
		return presaleCouponCategoryManager.editPresaleCouponCategory(edit, updateUser);
	}

	@Override
	public Boolean delPresaleCouponCategory(PresaleCouponCategory record, String updateUser) throws BizException {
		return presaleCouponCategoryManager.delPresaleCouponCategory(record, updateUser);
	}
	
	@Autowired
	private PresaleCouponCategoryJointManager presaleCouponCategoryJointManager;

	@Override
	public Long presaleCouponJointCount(Integer categoryId) {
		return presaleCouponCategoryJointManager.presaleCouponJointCount(categoryId);
	}

	@Override
	public PresaleCouponCategoryJoint getPresaleCouponCategoryJoint(Integer id) {
		return presaleCouponCategoryJointManager.get(id);
	}

	@Override
	public Pagination<PresaleCouponCategoryJoint> queryPresaleCouponCategoryJoint(Integer categoryId, String presaleCouponName, Page page) {
		return presaleCouponCategoryJointManager.query(categoryId, presaleCouponName, page);
	}

	@Override
	public Boolean addPresaleCouponCategoryJoint(List<AddPresaleCouponCategoryJointDTO> addList, String createUser) throws BizException {
		return presaleCouponCategoryJointManager.add(addList, createUser);
	}

	@Override
	public PresaleCouponCategoryJoint editPresaleCouponCategoryJoint(PresaleCouponCategoryJoint edit, String updateUser) throws BizException {
		return presaleCouponCategoryJointManager.edit(edit, updateUser);
	}

	@Override
	public Boolean delPresaleCouponCategoryJoint(PresaleCouponCategoryJoint edit, String updateUser) throws BizException {
		return presaleCouponCategoryJointManager.del(edit, updateUser);
	}

	@Override
	public Boolean isRelationCategory(Integer preCouponId, Integer categoryId) {
		return presaleCouponCategoryJointManager.isRelationCategory(preCouponId, categoryId);
	}

}
